 <!DOCTYPE html>
 
<%@ page import="java.sql.*" %> 
<%@ page import="java.io.*" %> 
<%@ page import="java.util.Date" %> 
<%@ page import="java.text.DateFormat" %> 
<%@ page import="java.text.SimpleDateFormat" %> 


<% 
try {
	
	String connectionURL = "jdbc:mysql://localhost:3306/unilearn"; 
	
	int c_row_count = 0;
	Connection connection = null;
	Statement stmt = null;
	ResultSet rst=null;

	Class.forName("com.mysql.jdbc.Driver").newInstance(); 

	connection = DriverManager.getConnection(connectionURL, "root", "");
	stmt = connection.createStatement();
	
	if(!connection.isClosed())
	{
		
		
		DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
		DateFormat dateFormat2 = new SimpleDateFormat("yyyy-MM-dd");
		DateFormat timeFormat = new SimpleDateFormat("HH:mm:ss");
		Date _now = new Date();
		
		String _assignment_id = request.getParameter("assignmentID");
		String _assignment_sub_id = request.getParameter("assignmentSubID");
		String _assignment_name = request.getParameter("assignmentName");
		
		// set session value
		//session.setAttribute("AssignmentName",  _assignment_name);
		
		//get session values
		String user_id = (String)session.getAttribute("UserID");
		String permission = (String)session.getAttribute("Permission");
		
	
%>

<html lang="en">
<head>
<script type="text/javascript">

</script>
<link rel="stylesheet" type="text/css" href="common.css">
<title>UniLearn System</title>
</head>
<body>
<form action="tuAssignmentMark.jsp" method="post" name="entry" onSubmit="return validate(this)">
<table class="TblBody" style="width:720px">
	<tr>
		<td>
			<div class="contentb">
				<table width="100%">
                    <tr>
                        <td  style="background-color:#ccff99; font-size:20px; font-weight:bold; width:70%; height:30px">Select Student</td>
						<!-- <td style="background-color:#ccff99; font-weight:bold;"><%= dateFormat2.format(_now) %>&nbsp;&nbsp; Time: <%= timeFormat.format(_now) %></td> -->
                    </tr>
					<tr>
                        <td colspan="2">
							<input type="hidden" name="datAssignmentSubID" value="<%= _assignment_sub_id %>" />
							<input type="hidden" name="datAssignmentID" value="<%= _assignment_id %>" />
							<input type="hidden" name="datAssignmentName" value="<%= _assignment_name %>" />
							<table border="1">
								<%
									rst = stmt.executeQuery("SELECT ass_mark_scheme_id, scheme_desc, maxScore From assignment_marking_scheme WHERE assignment_id = '"+_assignment_id+"'");
									int i = 0;
									while(rst.next())
									{	
									%>
										<tr>
											<td><%out.println(i + 1);%></td>
											<td>
												<input type="hidden" name="datAssMarkSchemeID<%out.println(i);%>" value="<%=rst.getString("ass_mark_scheme_id")%>" />
												<%=rst.getString("scheme_desc")%>
											</td>
											<td><input type="text" name="txtMarks<%out.println(i);%>" style="width:15px" />/<%=rst.getString("maxScore")%></td>
										</tr>
									<%
										i = i + 1;
									}
									
									if( i == 0)
									{
										out.println( "<script>alert('Not Schema For Marking'); window.location='markingSchema.jsp?AssignmentID="+_assignment_id+"'</script>" );
									}
								%>
								<tr>
									<input type="hidden" name="datRowCount" value="<% out.println(i); %>" />
									<td colspan="2"></td>
									<td><input type="submit" name="btnCommit" value="Commit" /></td>
								</tr>
							</table>
                        </td>
					</tr>
				</table>
			</div>
		</td>
	</tr>
</table>
</form>
<%
}
	}catch(Exception ex){

		out.println(ex);
	}
%>
</body>
</html>